package com.sky.mapper;

import com.sky.annotation.AutoFillUserId;
import com.sky.entity.User;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {
    /**
     * 通过openid获得用户信息
     * @param openId
     */
    @Select("select * from user where openid=#{openId}")
    User getUserByOpenId(String openId);

    /**
     * 拆入微信用户
     * @param user
     */
    void insert(User user);

    @Select("select * from user where id=#{userId}")
    @AutoFillUserId(OperationType.ADDARG)
    User getById(Long userId);
}
